home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / nameless.swf / scripts / DefineSprite_2144 / frame_1 / DoAction.as
Encoding:
Text File  |  2011-06-09  |  1.4 KB  |  74 lines

  1. if(!setVars)
  2. {
  3.    startY = _Y;
  4.    gg = 0;
  5.    setVars = true;
  6. }
  7. stop();
  8. onEnterFrame = function()
  9. {
  10.    if(_root.diff > 2000)
  11.    {
  12.       moveSpeed = 4;
  13.    }
  14.    else if(_root.diff > 1500)
  15.    {
  16.       moveSpeed = 5;
  17.    }
  18.    else if(_root.diff > 1000)
  19.    {
  20.       moveSpeed = 6;
  21.    }
  22.    else if(_root.diff > 500)
  23.    {
  24.       moveSpeed = 7;
  25.    }
  26.    if(_root.pauseMode == false)
  27.    {
  28.       if(_root.gameGo == true)
  29.       {
  30.          g.play();
  31.          if(go == false)
  32.          {
  33.             gotoAndStop(1);
  34.             _X = random(Stage.width);
  35.             _Y = startY;
  36.             maxNum = _root.diff / 20;
  37.             num = random(_root.diff / 20);
  38.             if(num == 1 or gg >= maxNum)
  39.             {
  40.                gg = 0;
  41.                go = true;
  42.             }
  43.             gg++;
  44.          }
  45.          else
  46.          {
  47.             if(_root.diff > 0)
  48.             {
  49.                if(_root.cm.hit.hitTest(this) && _currentframe == 1)
  50.                {
  51.                   gotoAndStop(2);
  52.                   _root.health -= 15;
  53.                }
  54.             }
  55.             if(_currentframe == 1)
  56.             {
  57.                if(_Y > -50)
  58.                {
  59.                   _Y = _Y - moveSpeed;
  60.                }
  61.                else
  62.                {
  63.                   go = false;
  64.                }
  65.             }
  66.          }
  67.       }
  68.    }
  69.    else
  70.    {
  71.       g.stop();
  72.    }
  73. };
  74.